package com.ea.admin.pojo.Enum;

import lombok.Getter;

@Getter
public enum RoleCode {
    SUPER_ADMIN(1, "超级管理员"),
    COMPANY_SUPER_ADMIN(2, "单位超级管理员"),
    COMPANY_ADMIN(3, "单位管理员"),
    DEPT_SUPER_ADMIN(4, "部门超级管理员"),
    DEPT_ADMIN(5, "部门管理员"),
    ;
    final Integer code;
    final String name;

    RoleCode(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static RoleCode getRoleCode(Integer code) {
        for (RoleCode roleCode : RoleCode.values()) {
            if (roleCode.getCode().equals(code)) {
                return roleCode;
            }
        }
        return null;
    }

}
